
<template>
	<view class="tabbar-container">
		<block>
			<view class="tabbar-item" v-for="(item, index) in tabbarList.value" :key="index"
				:class="[item.centerItem ? ' center-item' : '']" @click="changeItem(item)">
				<view class="item-top">
					<image :src="currentItem == item.id ? item.selectIcon : item.icon"></image>
				</view>
				<view class="item-bottom" :class="[currentItem == item.id ? 'item-active' : '']">
					<text>{{ item.text }}</text>
				</view>
			</view>
		</block>
 
	</view>
</template>  
 
<script setup>
import {ref,reactive} from 'vue'
		const props = () => {
			currentPage: {
				type: Number,
				default: 0
			}
		},
		const currentItem = ref(0)
		let	tabbarList = reactive([
			  {
				id:0,
				pagePath: "pages/index/index",
				text: "首页",
				iconPath: "static/images/首.png", 
				selectedIconPath: "static/images/首页-选中.png",
				centerItem: false
			  },
			  {
				id:0,
				pagePath: "pages/release_transfer/release_transfer",
				text: "发布",
				iconPath: "static/images/发布.png",
				selectedIconPath: "static/images/发布.png",
				centerItem: false
			  },
			  {
				id:0,
				pagePath: "pages/my/my",
				text: "我的",
				iconPath: "static/images/我的-2.png",
				selectedIconPath: "static/images/我的-2 (1).png",
				centerItem: false
			  }
			]) 
 
	mounted() {
		this.currentItem = this.currentPage;
		uni.hideTabBar();
	},

		const changeItem = (item)=> {
			if (item.id == 1) {
				// uni.scanCode({
				// 	success: (res) => {
				// 		console.log('扫码成功', res)
				// 	},
				// 	fail: (err) => {
				// 		console.log('扫码失败', err)
				// 	},
				// 	complete: () => {
				// 		console.log('扫码结束')
				// 	}
				// })
				console.log("adsadas")
			}
		}
	
 
</script>  
<style>
view {
	padding: 0;
	margin: 0;
	box-sizing: border-box;
}
 
.tabbar-container {
	position: fixed;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 150rpx;
	/* box-shadow: 0 0 5px #999;  */
	box-shadow: 0px 3px 20px rgba(0, 0, 0, 0.16);
	border-top: 1px;
	display: flex;
	align-items: center;
	/* padding: 5rpx 0; */
	color: #999999;
	z-index: 200;
	background-color: rgb(255, 255, 255);
	/* padding-bottom: 20rpx; */
}
 
.tabbar-container .tabbar-item {
	padding-top: 16rpx;
	flex: 1;
	height: 100%;
	display: flex;
	flex-direction: column;
	/* justify-content: center; */
	align-items: center;
	text-align: center;
}
 
.tabbar-container .item-active {
	color: #ec2928;
}
 
.tabbar-container .center-item {
	display: block;
	position: relative;
}
 
.tabbar-container .tabbar-item .item-top {
	width: 36rpx;
	height: 36rpx;
	/* padding: 10rpx; */
}
 
.tabbar-container .center-item .item-top {
	flex-shrink: 0;
	width: 144rpx;
	height: 144rpx;
	position: absolute;
	top: -50rpx;
	left: calc(50% - 72rpx);
	border-radius: 50%;
	box-shadow: 0px 3px 20px rgba(0, 0, 0, 0.16);
	/* box-shadow: 0 0 5px #999;  */
	background-color: #ec2928;
	background: url("../../../static/sao.jpg") no-repeat;
	background-size: contain;
}
 
.tabbar-container .tabbar-item .item-top image {
	width: 36rpx;
	height: 36rpx;
}
 
tabbar-container .tabbar-item:nth-child(3) .item-top image {
	background: #ff0000;
}
 
.tabbar-container .tabbar-item .item-bottom {
	margin-top: 14rpx;
	font-size: 20rpx;
	width: 100%;
}
 
.tabbar-container .center-item .item-bottom {
	position: absolute;
	bottom: 5rpx;
}
</style>